﻿<UserControl x:Class="CoolCode.Controls.Loading"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    >
    <Grid x:Name="LayoutRoot" Width="Auto" Height="Auto">
        <Grid Background="Black" Opacity="0.2"></Grid>
        <Canvas Width="320" Height="50">
            <Rectangle RadiusX="8" RadiusY="8" Stroke="{x:Null}" Fill="#19000000" Height="49" Width="316" Canvas.Left="6" Canvas.Top="3"/>
            <Rectangle RadiusX="8" RadiusY="8" Stroke="{x:Null}" Fill="#19000000" Height="48" Width="316" Canvas.Left="5" Canvas.Top="3"/>
            <Border Height="50" Width="320" Background="#FFFFFFFF" BorderBrush="#FFACACAC" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8">
                <Rectangle RadiusX="8" RadiusY="8" Stroke="{x:Null}" Margin="1,1,1,1">
                    <Rectangle.Fill>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFFFFFF"/>
                            <GradientStop Color="#FFE9E9E9" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
            </Border>
        </Canvas>
        <Grid Width="320" Height="50" VerticalAlignment="Center">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="5*" />
                <ColumnDefinition Width="10*" />
                <ColumnDefinition Width="80*" />
                <ColumnDefinition Width="5*" />
            </Grid.ColumnDefinitions>
            <Image Stretch="None" Source="Images/loading.png" Grid.Column="1" Opacity="0.3" />
            <Image x:Name="loadingImage" Stretch="None" Source="Images/loading.png" Grid.Column="1" RenderTransformOrigin="0.5,0.5">
                <Image.RenderTransform>
                    <RotateTransform Angle="0"></RotateTransform>
                </Image.RenderTransform>
            </Image>
            <TextBlock x:Name="titleText" FontFamily="Calibri" FontSize="13" Foreground="#FF000000" HorizontalAlignment="Left" Grid.Column="3"/>
            <TextBlock Text="Loading..." x:Name="loadingText"
    			FontFamily="Verdana" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="2"/>
        </Grid>
    </Grid>
    <UserControl.Resources>
        <Storyboard x:Name="storyboard">
            <DoubleAnimation Storyboard.TargetName="loadingImage"  Duration="0:0:0.7" To="360" Storyboard.TargetProperty="(UIElement.RenderTransform).RotateTransform.Angle" RepeatBehavior="Forever"></DoubleAnimation>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="loadingText" Storyboard.TargetProperty="Opacity" RepeatBehavior="Forever">
                <SplineDoubleKeyFrame KeyTime="00:00:0.0" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="00:00:0.5" Value="1"/>
                <SplineDoubleKeyFrame KeyTime="00:00:1.0" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>
</UserControl>
